package com.aspose.cells;

import java.util.ArrayList;

class zaor {
   public static double a(double var0) {
      double var2 = var0 - 0.5D;
      double var4;
      double var6;
      if (Math.abs(var2) <= 0.425D) {
         var4 = 0.180625D - var2 * var2;
         var6 = var2 * (((((((var4 * 2509.0809287301227D + 33430.57558358813D) * var4 + 67265.7709270087D) * var4 + 45921.95393154987D) * var4 + 13731.69376550946D) * var4 + 1971.5909503065513D) * var4 + 133.14166789178438D) * var4 + 3.3871328727963665D) / (((((((var4 * 5226.495278852854D + 28729.085735721943D) * var4 + 39307.89580009271D) * var4 + 21213.794301586597D) * var4 + 5394.196021424751D) * var4 + 687.1870074920579D) * var4 + 42.31333070160091D) * var4 + 1.0D);
      } else {
         if (var2 > 0.0D) {
            var4 = 1.0D - var0;
         } else {
            var4 = var0;
         }

         var4 = Math.sqrt(-Math.log(var4));
         if (var4 <= 5.0D) {
            var4 += -1.6D;
            var6 = (((((((var4 * 7.745450142783414E-4D + 0.022723844989269184D) * var4 + 0.2417807251774506D) * var4 + 1.2704582524523684D) * var4 + 3.6478483247632045D) * var4 + 5.769497221460691D) * var4 + 4.630337846156546D) * var4 + 1.4234371107496835D) / (((((((var4 * 1.0507500716444169E-9D + 5.475938084995345E-4D) * var4 + 0.015198666563616457D) * var4 + 0.14810397642748008D) * var4 + 0.6897673349851D) * var4 + 1.6763848301838038D) * var4 + 2.053191626637759D) * var4 + 1.0D);
         } else {
            var4 += -5.0D;
            var6 = (((((((var4 * 2.0103343992922881E-7D + 2.7115555687434876E-5D) * var4 + 0.0012426609473880784D) * var4 + 0.026532189526576124D) * var4 + 0.29656057182850487D) * var4 + 1.7848265399172913D) * var4 + 5.463784911164114D) * var4 + 6.657904643501103D) / (((((((var4 * 2.0442631033899397E-15D + 1.421511758316446E-7D) * var4 + 1.8463183175100548E-5D) * var4 + 7.868691311456133E-4D) * var4 + 0.014875361290850615D) * var4 + 0.1369298809227358D) * var4 + 0.599832206555888D) * var4 + 1.0D);
         }

         if (var2 < 0.0D) {
            var6 = -var6;
         }
      }

      return var6;
   }

   public static double a(double var0, double var2, double var4) {
      return a(var0) * var4 + var2;
   }

   public static double a(double var0, double var2, double var4, boolean var6) {
      return var6 ? 0.5D + d((var0 - var2) / var4) : c((var0 - var2) / var4) / var4;
   }

   public static double b(double var0) {
      return 0.5D + d(var0);
   }

   public static double a(double var0, ArrayList var2, ArrayList var3) {
      int var4 = var2.size();
      double var5 = 0.0D;
      double var7 = (Double)var3.get(0);
      ++var0;

      for(int var9 = 0; var9 < var4; ++var9) {
         var5 += (Double)var2.get(var9) / Math.pow(var0, ((Double)var3.get(var9) - var7) / 365.0D);
      }

      return var5;
   }

   private static double c(double var0) {
      return 0.3989422804014327D * Math.exp(-(var0 * var0) / 2.0D);
   }

   private static double d(double var0) {
      double[] var2 = new double[]{0.3989422804014327D, -0.06649038006690546D, 0.00997355701003582D, -0.00118732821548045D, 1.1543468761616E-4D, -9.4446562595E-6D, 6.6596935163E-7D, -4.122667415E-8D, 2.27352982E-9D, 1.1301172E-10D, 5.11243E-12D, -2.1218E-13D};
      double[] var3 = new double[]{0.4772498680518208D, 0.05399096651318805D, -0.05399096651318805D, 0.02699548325659403D, -0.00449924720943234D, -0.00224962360471617D, 0.0013497741628297D, -1.178374269137E-4D, -1.1515930357476E-4D, 3.704737285544E-5D, 2.82690796889E-6D, -3.54513195524E-6D, 3.7669563126E-7D, 1.9202407921E-7D, -5.22690859E-8D, -4.91799345E-9D, 3.66377919E-9D, -1.5981997E-10D, -1.7381238E-10D, 2.624031E-11D, 5.60919E-12D, -1.72127E-12D, -8.634E-14D, 7.894E-14D};
      double[] var4 = new double[]{0.4999683287581669D, 1.3383022576489E-4D, -2.6766045152977E-4D, 3.3457556441221E-4D, -2.8996548915725E-4D, 1.8178605666397E-4D, -8.252863922168E-5D, 2.551802519049E-5D, -3.91665839292E-6D, -7.4018205222E-7D, 6.4422023359E-7D, -1.737015534E-7D, 9.09595465E-9D, 9.44943118E-9D, -3.29957075E-9D, 2.9492075E-10D, 1.1874477E-10D, -4.420396E-11D, 3.61422E-12D, 1.43638E-12D, -4.5848E-13D};
      double[] var5 = new double[]{-1.0D, 1.0D, -3.0D, 15.0D, -105.0D};
      double var6 = Math.abs(var0);
      double var8 = (double)((short)((int)e(var6)));
      double var10 = 0.0D;
      if (var8 == 0.0D) {
         var10 = a(var2, 11, var6 * var6) * var6;
      } else if (var8 >= 1.0D && var8 <= 2.0D) {
         var10 = a(var3, 23, var6 - 2.0D);
      } else if (var8 >= 3.0D && var8 <= 4.0D) {
         var10 = a(var4, 20, var6 - 4.0D);
      } else {
         var10 = 0.5D + c(var6) * a(var5, 4, 1.0D / (var6 * var6)) / var6;
      }

      return var0 < 0.0D ? -var10 : var10;
   }

   private static double e(double var0) {
      double var2 = Math.floor(var0);
      return a(var0 - 1.0D, var2) && !a(var0, var2) ? var2 + 1.0D : var2;
   }

   private static boolean a(double var0, double var2) {
      if (var0 == var2) {
         return true;
      } else {
         double var4 = var0 - var2;
         return (var4 < 0.0D ? -var4 : var4) < (var0 < 0.0D ? -var0 : var0) * 3.552713678800501E-15D;
      }
   }

   private static double a(double[] var0, int var1, double var2) {
      double var4 = var0[var1];

      for(int var6 = var1 - 1; var6 >= 0; --var6) {
         var4 = var0[var6] + var4 * var2;
      }

      return var4;
   }
}
